# @Filename:    Sample1-add
# @Author:      王佳伟
# @Time:        2025-02-28 9:25
# @Describe:    计算斐波那契数列
import unittest


def fibonacci(n):
    if n <= 0:
        return 0
    elif n == 1:
        return 1
    else:
        a, b = 0, 1
        for _ in range(2, n + 1):
            a, b = b, a + b
        return b


class TestFibonacci(unittest.TestCase):
    def test_fibonacci(self):
        self.assertEqual(fibonacci(0), 0)
        self.assertEqual(fibonacci(1), 1)
        self.assertEqual(fibonacci(5), 5)
        self.assertEqual(fibonacci(10), 55)


if __name__ == '__main__':
    unittest.main()
